package com.mvw.tetrominoes.data {
	
	import flash.display.DisplayObject;
	
	import mx.containers.Box;
	import mx.containers.Canvas;
	import mx.controls.Button;
	
	/**
	 * An individaul square within the playing area.
	 */
	public class Cell {
		
		public var x:int;
		public var y:int;
		
		/**
		 * The constructor instantiates the object by setting it's position.
		 * 
		 * @param x The x position of the Cell.
		 * @param y The y position of the Cell.
		 */
		public function Cell(x:int = 0, y:int = 0):void {
			this.x = x;
			this.y = y;
		}
		
		/**
		 * Returns a DisplayObject representation of a cell.
		 * 
		 * @param scale The scale in pixels, for position calculation.
		 * 
		 * @return Returns a disabled Button instance.
		 */
		public function toDisplayObject(scale:int):DisplayObject {
			var displayObject:DisplayObject;
			
			var button:Button = new Button();
			button.enabled = false;
			button.styleName = "cell";
			displayObject = button;
		
			displayObject.height = scale;
			displayObject.width = scale;
			
			displayObject.x = x * scale;
			displayObject.y = y * scale;
			
			return displayObject;
		}

	}
}